Optimal. Leaf size=107 \[ \frac {a^2 (B+i A) \tan (c+d x)}{d}-\frac {2 a^2 (A-i B) \log (\cos (c+d x))}{d}-2 a^2 x (B+i A)+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.12, antiderivative size = 107, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3592, 3527, 3477, 3475} \[ \frac {a^2 (B+i A) \tan (c+d x)}{d}-\frac {2 a^2 (A-i B) \log (\cos (c+d x))}{d}-2 a^2 x (B+i A)+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3477
Rule 3527
Rule 3592
Rubi steps
\begin {align*} \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}+\int (a+i a \tan (c+d x))^2 (-B+A \tan (c+d x)) \, dx\\ &=\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}-(i A+B) \int (a+i a \tan (c+d x))^2 \, dx\\ &=-2 a^2 (i A+B) x+\frac {a^2 (i A+B) \tan (c+d x)}{d}+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}+\left (2 a^2 (A-i B)\right ) \int \tan (c+d x) \, dx\\ &=-2 a^2 (i A+B) x-\frac {2 a^2 (A-i B) \log (\cos (c+d x))}{d}+\frac {a^2 (i A+B) \tan (c+d x)}{d}+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 4.34, size = 273, normalized size = 2.55 \[ \frac {(a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \left ((A-i B) \cos ^3(c+d x) (-4 d x \sin (2 c)-4 i d x \cos (2 c))+2 (B+i A) (\cos (2 c)-i \sin (2 c)) \cos ^3(c+d x) \tan ^{-1}(\tan (3 c+d x))+\frac {1}{3} (6 A-7 i B) \sec (c) (\sin (2 c)+i \cos (2 c)) \sin (d x) \cos ^2(c+d x)-(A-i B) (\cos (2 c)-i \sin (2 c)) \cos ^3(c+d x) \log \left (\cos ^2(c+d x)\right )-\frac {1}{6} (\cos (2 c)-i \sin (2 c)) (3 A+2 B \tan (c)-6 i B) \cos (c+d x)+\frac {1}{3} B \cos (c) (\tan (c)+i)^2 \sin (d x)\right )}{d (\cos (d x)+i \sin (d x))^2 (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.41, size = 175, normalized size = 1.64 \[ -\frac {2 \, {\left (3 \, {\left (3 \, A - 5 i \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (5 \, A - 6 i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (6 \, A - 7 i \, B\right )} a^{2} + 3 \, {\left ({\left (A - i \, B\right )} a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (A - i \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (A - i \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.52, size = 312, normalized size = 2.92 \[ -\frac {6 \, A a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 6 i \, B a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 18 i \, B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 18 i \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} - 30 i \, B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 30 \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 36 i \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + 6 \, A a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 6 i \, B a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 12 \, A a^{2} - 14 i \, B a^{2}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.02, size = 158, normalized size = 1.48 \[ \frac {i a^{2} B \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {a^{2} B \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 i a^{2} A \tan \left (d x +c \right )}{d}-\frac {a^{2} A \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {2 a^{2} B \tan \left (d x +c \right )}{d}-\frac {i a^{2} B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {a^{2} A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {2 i a^{2} A \arctan \left (\tan \left (d x +c \right )\right )}{d}-\frac {2 a^{2} B \arctan \left (\tan \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.90, size = 94, normalized size = 0.88 \[ -\frac {2 \, B a^{2} \tan \left (d x + c\right )^{3} + 3 \, {\left (A - 2 i \, B\right )} a^{2} \tan \left (d x + c\right )^{2} - 6 \, {\left (d x + c\right )} {\left (-2 i \, A - 2 \, B\right )} a^{2} - 6 \, {\left (A - i \, B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - {\left (12 i \, A + 12 \, B\right )} a^{2} \tan \left (d x + c\right )}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.13, size = 111, normalized size = 1.04 \[ \frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {a^2\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}+\frac {B\,a^2\,1{}\mathrm {i}}{2}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^2\,\left (B+A\,1{}\mathrm {i}\right )+B\,a^2+A\,a^2\,1{}\mathrm {i}\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (2\,A\,a^2-B\,a^2\,2{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [B] time = 0.70, size = 178, normalized size = 1.66 \[ - \frac {2 a^{2} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 12 A a^{2} + 14 i B a^{2} + \left (- 30 A a^{2} e^{2 i c} + 36 i B a^{2} e^{2 i c}\right ) e^{2 i d x} + \left (- 18 A a^{2} e^{4 i c} + 30 i B a^{2} e^{4 i c}\right ) e^{4 i d x}}{3 d e^{6 i c} e^{6 i d x} + 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} + 3 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________